package kr.co.graviti.service.authority;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@SuppressWarnings("unchecked")
public class AuthorityServiceImp implements AuthorityService{

	@Autowired
	private SqlMapClientTemplate sqlMapClientTemplate;
	
	@Override
	public List<HashMap<String, Object>> selectMenuList(HashMap<String, Object> param) {
		return (List<HashMap<String, Object>>)this.sqlMapClientTemplate
			.queryForList("Authority.selectMenuList", param);
	}

	@Override
	public void insertAdminAuthority(HashMap<String, Object> param) {
		this.sqlMapClientTemplate.insert("Authority.insertAdminAuthority", param);
	}

	@Override
	public void insertAdminInfo(HashMap<String, Object> param) {
		this.sqlMapClientTemplate.insert("Authority.insertAdminInfo", param);
	}

	@Override
	public List<HashMap<String, Object>> selectAdminList(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return (List<HashMap<String, Object>>)this.sqlMapClientTemplate
			.queryForList("Authority.selectAdminList", param);
	}

	@Override
	public int selectCountAdminList(HashMap<String, Object> param) {
		return (Integer)this.sqlMapClientTemplate
			.queryForObject("Authority.selectCountAdminList", param);
	}

	@Override
	public int selectDuplicationUserid(String userid) {
		return (Integer)this.sqlMapClientTemplate
			.queryForObject("Authority.selectDuplicationUserid", userid);
	}

	@Override
	public HashMap<String, Object> selectAdminInfoByUserid(HashMap<String, Object> param) {
		return (HashMap<String, Object>)this.sqlMapClientTemplate
			.queryForObject("Authority.selectAdminInfoByUserid", param);
	}

	@Override
	public List<HashMap<String, Object>> selectAdminAuthInfoByUserid(
			HashMap<String, Object> param) {
		return (List<HashMap<String, Object>>)this.sqlMapClientTemplate
			.queryForList("Authority.selectAdminAuthInfoByUserid", param);
	}

	@Override
	public void deleteAdminAuthByUserid(HashMap<String, Object> param) {
		this.sqlMapClientTemplate.delete("Authority.deleteAdminAuthByUserid", param);
	}

	@Override
	public void updateAdminInfoByUserid(HashMap<String, Object> param) {
		this.sqlMapClientTemplate.update("Authority.updateAdminInfoByUserid", param);
	}

	@Override
	public void deleteAdminInfoByUserid(HashMap<String, Object> param) {
		this.sqlMapClientTemplate.delete("Authority.deleteAdminInfoByUserid", param);
	}

}
